//
//  Ball.m
//  解归档
//
//  Created by apple on 15/9/6.
//  Copyright (c) 2015年 戴维营. All rights reserved.
//

#import "Ball.h"

@implementation Ball

//归档

//归档时，需要对对象中的成员进行编码；
- (void)encodeWithCoder:(NSCoder *)aCoder
{
    [aCoder encodeObject:self.color forKey:@"color"];
    [aCoder encodeFloat:self.weight forKey:@"weight"];
}

//解归档
- (instancetype)initWithCoder:(NSCoder *)aDecoder
{
    if (self = [super init])
    {
        self.color = [aDecoder decodeObjectForKey:@"color"];
        self.weight = [aDecoder decodeFloatForKey:@"weight"];
    }
    return self;
}



@end
